package com.jinke.api.modules.ums.controller;

import com.jinke.api.common.api.CommonResult;
import com.jinke.api.modules.ums.dto.CostComputeAddOrUpdateDto;
import com.jinke.api.modules.ums.service.ICostComputeService;
import com.jinke.api.modules.ums.service.ICostComputeStatsService;
import com.jinke.api.modules.ums.vo.CostComputeVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 价格计算相关Controller
 *
 * @author huang
 * @data 2024-05-15
 */
@Slf4j
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/admin/compute")
public class CostComputeController {
    private final ICostComputeService iCostComputeService;

    /**
     * 新增（编辑）
     */
    @PostMapping("/addOrUpdate")
    public CommonResult addOrUpdate(@Validated @RequestBody List<CostComputeAddOrUpdateDto> dtoList) {
        return iCostComputeService.addOrUpdate(dtoList);
    }

    /**
     * 查看
     */
    @GetMapping("/getInfo")
    public CommonResult<List<CostComputeVO>> getInfo(){
        return iCostComputeService.getInfo();
    }
}
